package com.pen.interfece.mapper;

import com.github.pagehelper.Page;
import com.pen.interfece.pojo.dto.StudentDTO;
import com.pen.interfece.pojo.dto.StudentPageQueryDTO;
import com.pen.interfece.pojo.entity.Disciplinary;
import com.pen.interfece.pojo.entity.Student;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface StudentMapper {


    void insert(Student student);
    @Delete("delete from student where id = #{id}")
    void deleteById(Long id);

    void update(StudentDTO studentDTO);

    @Insert("insert into disciplinary(type, number,student_id,name,time,other) " +
            "values"+
            "(#{type}, #{number},#{studentId},#{name},#{time},#{other})")
    void addDisciplinary(Disciplinary disciplinary);
@Select(" select * from student where name like concat('%',#{name},'%')")
    Page<Student> pageQuery(StudentPageQueryDTO studentPageQueryDTO);
@Select("select * from student where id=#{id}")
    Student getStudentById(int id);
}
